import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
let routes = [
  {
    path: '/',
    name: 'home',
    meta: {
      title: 'JouEylGPT'
    },
    component: () => import('../views/HomeView.vue')
  },
  {
    path: '/addApi',
    name: 'addApi',
    meta: {
      title:'填写token'
    },
    component:()=>import('../views/addApi.vue')
  },
  {
    path: '/404',
    name: '404',
    component: () => import('../views/module/404.vue')
  },
  {
    path: '*',
    redirect:'/404'
  }
]
const router = new VueRouter({
  routes
})
router.beforeEach(async (to, from, next) => {
  document.title = to.meta.title
  next()
})
export default router
